<?php

if (!defined('TOBBIVM'))
	header('location:/template/notrepassing.php');
/**
 * This file is part of TobbiVMShop.
 *
 * TobbiVMShop is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TobbiVMShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TobbiVMShop.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * Display userdata after registry
 * get: register.show.data.tpl.php
 * used from register.verify.php
 *
 * @version    $Id$
 * @package    TobbiVM-Shop
 * @copyright  Copyright (C) 2012
 * @author     Norbert Gebert
 * @license    GPL3
 */
db::getInstance()->where('page_name', 'ok-registration');
$result = db::getInstance()->getOne('page');

$refPage->assign('header', $result['page_header']);
$refPage->assign('text', $result['page_text']);

db::getInstance()->where('customer_name', $_POST['namex']);
$result = db::getInstance()->getOne('customer');

if ($result === NULL)
{
	// Error in Userdata
	message::setErrorRow(_('Could not find userdata!'), TRUE);
	message::setErrorRow(_('Please contact the administrator at'), FALSE);
	message::setErrorRow(ADMIN_EMAIL, FALSE);

	$pagefile = 'module/register/register.new.php';
	if (is_file($pagefile))
		include_once($pagefile);
}
else
{
	if (COMPANY > 0)
	{
		$refPage->assign('company', _('Company'));
		$refPage->assign('companyx', $result['customer_company']);
	}

	if (FIRSTNAME > 0)
	{
		$refPage->assign('firstname', _('Firstname'));
		$refPage->assign('firstnamex', $result['customer_firstname']);
	}

	if (LASTNAME > 0)
	{
		$refPage->assign('lastname', _('Lastname'));
		$refPage->assign('lastnamex', $result['customer_lastname']);
	}

	if (STREET > 0)
	{
		$refPage->assign('street', _('Street and Number'));
		$refPage->assign('streetx', $result['customer_street']);
	}


	if (ZIP_CODE > 0)
	{
		$refPage->assign('zip', _('Zipcode'));
		$refPage->assign('zipx', $result['customer_zip']);
	}

	if (CITY > 0)
	{
		$refPage->assign('city', _('City'));
		$refPage->assign('cityx', $result['customer_city']);
	}

	if (COUNTRY > 0)
	{
		$refPage->assign('country', _('Country'));
		$refPage->assign('countryx', $result['customer_country']);
	}

	if (STATE > 0)
	{
		$refPage->assign('state', _('State'));
		$refPage->assign('statex', DEFAULT_STATE);
	}

	if (PHONE > 0)
	{
		$refPage->assign('phone', _('Phone'));
		$refPage->assign('phonex', $result['customer_phone']);
	}

	if (FAX > 0)
	{
		$refPage->assign('fax', _('Fax'));
		$refPage->assign('faxx', $result['customer_fax']);
	}

	if (MOBILE > 0)
	{
		$refPage->assign('handy', _('Mobil'));
		$refPage->assign('handyx', $result['customer_handy']);
	}

	if (EMAIL > 0)
	{
		$refPage->assign('email', _('E-Mail'));
		$refPage->assign('emailx', $result['customer_email']);
	}
	$refPage->assign('name', _('Username') . '*');
	$refPage->assign('namex', $result['customer_name']);

	$refPage->addtpl('content', '/register.show.data.tpl.php');
}
?>